package com.baseDemo.web.server;

import java.sql.Connection;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.Map;

import javax.annotation.Resource;


import com.mchange.v2.c3p0.ComboPooledDataSource;

public class SystemServer {
	@Resource
	private ComboPooledDataSource dataSource;
	//@Resource private PropertyResourceConfigurer  propertyConfigurer;
	private static SystemServer uniqueInstance = null;
	private Map<String, Object> sysMap = new HashMap<String, Object>();
	private SystemServer() {

	}

	public static SystemServer getInstance() {
		if (uniqueInstance == null) {
			uniqueInstance = new SystemServer();
		}
		return uniqueInstance;
	}
	public void set(String key,Object value){
		sysMap.put(key, value);
	}
	public Object get(String key){
		return sysMap.get(key);
	}
	/**
	 * 获取connection
	 * @return
	 * @throws SQLException
	 */
	public Connection getConnection() throws SQLException{
		return dataSource.getConnection();
	}
	public ComboPooledDataSource getDataSource(){
		return dataSource;
	}
}
